package com.shop.front.vo.pink;

import com.alibaba.fastjson.annotation.JSONField;
import com.shop.jpa.domain.BaseDomain;
import com.shop.common.enums.pink.StorePinkStatusEnum;
import com.shop.util.IdSignUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.persistence.*;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

@ApiModel("StorePinkVo 拼团记录")
@Data
public class StorePinkVo extends BaseDomain implements Serializable {

    @ApiModelProperty(value = "id", hidden = true)
	@Id
    @Column(name = "id")
	@JSONField(serialize=false)
    private Long id;

    /**
	 * 用户id
	 */
    @ApiModelProperty("用户id")
	@Column(name = "uid")
    @JSONField(serialize = false)
    private Long uid;

    /**
	 * 拼团id
	 */
    @ApiModelProperty("拼团id")
	@Column(name = "pink_id")
    @JSONField(serialize = false)
    private Long pinkId;

    /**
     * 地址id
     */
    @ApiModelProperty("地址id")
    @Column(name = "user_address_id")
    @JSONField(serialize = false)
    private Long userAddressId;

    /**
	 * 订单id 生成
	 */
    @ApiModelProperty("订单id 生成")
	@Column(name = "order_no")
    private String orderNo;

    /**
	 * 购买总金额
	 */
    @ApiModelProperty("购买总金额")
	@Column(name = "total_price")
    private BigDecimal totalPrice;

    /**
	 * 商品id
	 */
    @ApiModelProperty("商品id")
	@Column(name = "product_id")
    @JSONField(serialize = false)
    private Long productId;

    /**
	 * 产品规格id
	 */
    @ApiModelProperty("产品规格id")
	@Column(name = "product_attr_value_id")
    @JSONField(serialize = false)
    private Long productAttrValueId;

    /**
	 * 拼团商品单价
	 */
    @ApiModelProperty("拼团商品单价")
	@Column(name = "price")
    private BigDecimal price;

    /**
	 * 状态1进行中2已完成3已中奖4取消
	 */
    @ApiModelProperty("状态0 未支付 1进行中（已支付）,2已中奖,3寄售，4提货，5取消")
	@Column(name = "status")
    private int status;

    /**
	 * 拼团次数
	 */
    @ApiModelProperty("拼团次数")
	@Column(name = "pink_num")
    private Integer pinkNum;

    /**
	 * 总返利金额
	 */
    @ApiModelProperty("总返利金额")
	@Column(name = "total_amount")
    private BigDecimal totalAmount;

    /**
	 * 返佣状态0默认1可以返佣2返佣完成
	 */
    @ApiModelProperty("返佣状态0默认1可以返佣2返佣完成")
	@Column(name = "rebate_status")
    private Integer rebateStatus;

    /**
	 * 是否单论最后一单中奖（是否第五单）
	 */
    @ApiModelProperty("是否单论最后一单中奖（是否第五单）")
	@Column(name = "is_last_prize")
    private Integer isLastPrize;

    /**
	 * 下单时间
	 */
    @ApiModelProperty("下单时间")
	@Column(name = "create_time")
    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;

    /**
	 * 中奖时间
	 */
    @ApiModelProperty("中奖时间")
	@Column(name = "zj_time")
    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    private Date zjTime;

    /**
     * 商品规格
     */
    @ApiModelProperty("规格")
    @Column(name = "suk")
    private String suk;

    /**
     * 商品名称
     */
    @ApiModelProperty("商品名称")
    @Column(name = "store_name")
    private String storeName;

    /**
     * 图片
     */
    @ApiModelProperty("图片")
    @Column(name = "image")
    private String image;

    @ApiModelProperty("状态")
    @Transient
    private String statusStr;
    public String getStatusStr() {
        return StorePinkStatusEnum.val(this.status).getName();
    }

    @ApiModelProperty("收货地址ID")
    @Transient
    private String userAddressSign;
    public String getUserAddressSign() {
        return IdSignUtil.doSign(this.userAddressId);
    }

}